home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 23 / AACD 23.iso / AACD / Programming / tek / msg / dropmsg.c < prev    next >
C/C++ Source or Header  |  2001-05-12  |  578b  |  39 lines

  1.  
  2. #include "tek/msg.h"
  3. #include "tek/kn/exec.h"
  4.  
  5. /* 
  6. **    TEKlib
  7. **    (C) 2001 TEK neoscientists
  8. **    all rights reserved.
  9. **
  10. **    TVOID TDropMsg(TAPTR msg)
  11. **
  12. **    drop message.
  13. */
  14.  
  15. TVOID TDropMsg(TAPTR mem)
  16. {
  17.     if (mem)
  18.     {
  19.         TMSG *msg = ((TMSG *) mem) - 1;
  20.         TPORT *replyport = msg->replyport;
  21.  
  22.         if (replyport)
  23.         {
  24.             msg->status = TMSG_STATUS_FAILED | TMSG_STATUS_PENDING;
  25.  
  26.             kn_lock(&replyport->lock);
  27.  
  28.             TAddTail(&replyport->msglist, (TNODE *) msg);
  29.             TSignal(replyport->sigtask, replyport->signal);
  30.  
  31.             kn_unlock(&replyport->lock);
  32.         }
  33.         else
  34.         {
  35.             TMMUFreeHandle(msg);
  36.         }
  37.     }
  38. }
  39.